<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<base href="${pageContext.request.contextPath}/">
<title>无标题文档</title>
<style type="text/css">
td {
	/* border:1px solid #ccc; */
	text-align: center
}

th {
	/* border:1px solid #ccc; */
	background-color: #EEE;
	height: 30px;
}
</style>
<link rel="stylesheet" href="css/main.css" />
<link rel="stylesheet" href="css/pagestyle.css" type="text/css">
<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="js/UserlistSelect.js"></script>
<script type="text/javascript">
	$(function() {
		$("#data").css("background-color", "#DDD");
		$("#data tr").css("background-color", "#FFF");
		$("#data tr td").css("height", "24");
		$('#data tr').bind("mouseover", function() {
			$(this).css("background-color", "#EEE");
		});
		$('#data tr').bind("mouseout", function() {
			$(this).css("background-color", "white");
		});
	});
</script>

<c:if test="${!empty resetResult}">
	<script type="text/javascript">
		alert('${resetResult }');
	</script>
</c:if>

</head>
<body>
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td width="153" height="48"><img
				src="images/groupmanagerlogo.gif" width="153" height="48"></td>
			<td background="images/maintitle-bg.gif">&nbsp;</td>
			<td width="80"><img src="images/maintitle-right.gif" width="80"
				height="48"></td>
		</tr>
	</table>
	<div style="width: 800px; margin: 10px auto; color: #F00"></div>
	<div style="width: 95%; margin: 15px auto; padding-bottom: 10px;">
		<div style="float:left;">
		     <button onclick="confirm('请确认删除!');deletecheck();" >删除</button>
		</div>
		<div style="float: right">
			<a href="content/user/register.jsp">添加新用户</a>
		</div>
	</div>
	<table id="data" width="95%" cellpadding="0" cellspacing="1"
		align="center">
		<tr>
			<th>
			    <input name="allCheck" type="checkbox" onclick="selectAll()" value="全选">全选 
				<input type="hidden" name="checkinfo" id="checkinfo"> 
			</th>
			<th>用户名</th>
			<th>年龄</th>
			<th>性别</th>
			<th>爱好</th>
			<th>注册时间</th>
			<th>编辑</th>
			<th>删除</th>
			<th>重置密码</th>
			<th>冻结用户</th> 
		</tr>

		<c:forEach items="${pagemodel.modellist}" var="item">
			<tr>
				<td>
					<c:if test="${item.userid != 1 }">
				    	<input name="oneCheck" onclick="checkone()" type="checkbox" style="margin-left: 20px" value="${item.userid}">
					</c:if>
				</td>
				<td style="height:25px;width: 200px;text-align: center;">
					<img style="width: 25px;height: 25px;margin-right: 10px;" src="${item.headerimg }">${item.username }
				</td>
				<td>${item.age }</td>
				<td>${item.gender }</td>
				<td>${item.favorite }</td>
				<td>
					<fmt:formatDate value="${item.regdate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					<a href="editUserServlet?id=${item.userid}"><img src="images/edit.gif" border="0"></a>
				</td>
				<td>
					<c:if test="${item.roleid!=1 }">
						<a href="delUserServlet?userid=${item.userid}" onclick="return confirm('你确定要删除该用户吗?')"><img src="images/delimg.gif"> </a>
					</c:if>
				</td>
				<td>
					<a href="ResetPassServlet?userid=${item.userid }">重置密码</a>
				</td>
				<c:if test="${item.roleid eq 1 }">
				 	<td></td>
				</c:if>
				<c:if test="${item.roleid eq 2 }">
					<td>
					    <c:if test="${item.state eq 1}">
					    	[用户<span style="color:green;font-weight: 600">活动</span>中]<a href="OffUserServlet?userid=${item.userid }" onclick="return confirm('你确定冻结此用户吗?');">锁定</a>
					    </c:if>
					    <c:if test="${item.state eq 0}">
					    	[用户<span style="color:red;font-weight: 600">冻结</span>中]<a href="OpenUserServlet?userid=${item.userid }" onclick="return confirm('你确定解锁此用户吗?');">解锁</a>
					    </c:if>
					</td>
				</c:if>
			</tr>
		</c:forEach>
	</table>
	
	
 	
	<table align="center" style="margin-top: 20px">
		<tr><td>页数${pagemodel.pageIndex}/${pagemodel.pageCount} &nbsp;&nbsp; 每页${pagemodel.pageSize } &nbsp;&nbsp; 文档总数${pagemodel.recordCount}  &nbsp;&nbsp; 
		<c:choose>
			<c:when test="${pagemodel.pageIndex!=1 }"><a href="userlistServlet?pageIndex=${(pagemodel.pageIndex-1)}">上一页</a></c:when>
			<c:otherwise>上一页</c:otherwise>
		</c:choose>
		<c:choose>
			<c:when test="${pagemodel.pageIndex!=pagemodel.pageCount}"><a href="userlistServlet?pageIndex=${(pagemodel.pageIndex+1)}">下一页</a></c:when>
			<c:otherwise>下一页</c:otherwise>
		</c:choose>
	</table> 


<%-- <c:out value="${pagemodel.pageing }" escapeXml="false"></c:out> --%>

</body>
</html>
